Skip to content

Fix AV1 benchmark loading of input filepaths - #364

Draft
linjiaye929 wants to merge 1 commit into
InterDigitalInc:masterfrom
linjiaye929:fix-av1-input-filepath
Draft

linjiaye929 wants to merge 1 commit into
InterDigitalInc:masterfrom
linjiaye929:fix-av1-input-filepath

Conversation

@linjiaye929

Copy link
Copy Markdown

Fixes #328.

AV1 inherits Codec.run(), which passes an input filepath into _run_impl(). Converting that path directly with np.asarray() creates a scalar array and fails during the YUV transpose. Load the file through the shared _load_img() helper, as the other image codecs do, before converting to YUV.

Adds real AOM roundtrip regression tests for RGB, RGBA and grayscale PNG inputs using both str and pathlib.Path paths. The tests explicitly skip when aomenc/aomdec are unavailable.

Validation:

  • Before the fix, all six new cases fail with "axes don't match array".
  • After the fix, all six real encode/decode cases plus the existing benchmark CLI test pass (7 passed, no skips).
  • Tested with Python 3.12, PyTorch 2.6 CPU and AOM 3.12.1, using the native CompressAI extensions.
  • Ruff check and format checks pass for both changed files.
  • Additional local real-AOM checks covered odd dimensions, transparency and paths containing spaces.

The existing JPEG fixture test, full test suite, GPU/Python matrix and upstream CI have not been verified. AOM regression tests may be skipped in CI if its external binaries are absent. Keeping this PR as a draft pending broader validation.

Prepared with AI assistance; test results above are from actual local runs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

There is a bug in the bench av1

1 participant